<!--
 * @Author: White
 * @description: 封装element表格组件公共
 * @LastEditTime: 2021-06-28 20:42:46
-->

<template>
  <el-table border :data="tableData" height="300">
      <!-- 循环父子间传入的数组配置项 -->
      <template v-for="colConfig in colConfigs">
        <slot v-if="colConfig.slot" :name="colConfig.slot"></slot>
        <!-- 指定 component 属性来特殊处理某列 -->
        <component
          :key="colConfig.id"
          v-else-if="colConfig.component"
          :is="colConfig.component"
          :col-config="colConfig">
        </component>
        <!-- 每列的配置项 -->
        <el-table-column v-else v-bind="colConfig" :key="colConfig.id" />
      </template>  
    </el-table>
</template>

<script>
export default {
  props: {colConfigs: Array, tableData: Array}
}
</script>